package com.velpro.im.controller.base;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public class BaseController {

    protected static final int PAGE_SIZE = 10;
    protected static final int PAGE_SIZE_DOWNLOAD = 100000;
    
    final static Logger logger =  LoggerFactory.getLogger(BaseController.class);

    public static HttpServletRequest getRequest() {
        ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        return attrs.getRequest();
    }

    public static HttpServletResponse getResponse() {
        ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        return attrs.getResponse();
    }

    public static HttpSession getSession() {
        return getRequest().getSession();
    }
    
    

    protected String pageNotFound() {
        return "/error/404";
    }

    
}
